using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using CustomerMgr.Data.Models.Mapping;

namespace CustomerMgr.Data.Models
{
    public class ordermanagerContext : DbContext
    {
        static ordermanagerContext()
        {
            Database.SetInitializer<ordermanagerContext>(null);
        }

		public ordermanagerContext()
			: base("Name=ordermanagerContext")
		{
		}
                
        public DbSet<Customer> Customers { get; set; }
        public DbSet<Debit> Debits { get; set; }
        public DbSet<Order> Orders { get; set; }
        public DbSet<OrderDetail> OrderDetails { get; set; }
        public DbSet<Product> Products { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Configurations.Add(new CustomerMap());
            modelBuilder.Configurations.Add(new DebitMap());
            modelBuilder.Configurations.Add(new OrderMap());
            modelBuilder.Configurations.Add(new OrderDetailMap());
            modelBuilder.Configurations.Add(new ProductMap());
        }
    }
}
